Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an advanced tutorial for plotting focal mechanisms (beachballs) #2550

Merged
merged 154 commits into from
Mar 24, 2025

Conversation

yvonnefroehlich
Copy link
Member

@yvonnefroehlich yvonnefroehlich commented May 29, 2023

Description of proposed changes

This PR aims to add a tutorial showing how to plot focal mechanisms using pygmt.Figure.meca. It focuses on how the display of the beachballs can be adjusted and modified:

  • Filling the quadrants
  • Plotting the P and T axes
  • Plotting the components of a seismic moment tensor
  • Adjusting the outlines
  • Highlighting the nodal planes
  • Adding offset from the event location
  • Adding a label
  • Using size-coding and color-coding

Related PRs (need to be merged before this PR is mergd)

Backup of code for plotting the P and T axes

# %%
# Plotting the P and T axes
# -------------------------
#
# Wait for PR #3526

fig = pygmt.Figure()
fig.basemap(region=[-size, size] * 2, projection=projection, frame=frame)

fig.meca(
    spec=mt_dict_single,
    scale="1c",
    longitude=-2,
    latitude=0,
    Fa=True,
)

fig.meca(
    spec=mt_dict_single,
    scale="1c",
    longitude=2,
    latitude=0,
    Fa="0.2c/cd",  # Compute and plot P and T axes with symbols, Adjust size and symbols
    Fe="darkorange",  # Adjust fill of T axis symbol
    Fg="gray30",  # Adjust fill of P axis symbol
    Ft="0.8p,cornsilk",  # Adjust outline of T axis symbol
    Fp="0.8p,gray60",  # Adjust outline of P axis symbol
)

fig.show()

Preview: https://pygmt-dev--2550.org.readthedocs.build/en/2550/tutorials/advanced/focal_mechanisms.html

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If wrapping a new module, open a 'Wrap new GMT module' issue and submit reasonably-sized PRs.
  • If adding new functionality, add an example to docstrings or tutorials.
  • Use underscores (not hyphens) in names of Python files and directories.

Slash Commands

You can write slash commands (/command) in the first line of a comment to perform
specific operations. Supported slash commands are:

  • /format: automatically format and lint the code
  • /test-gmt-dev: run full tests on the latest GMT development version

@yvonnefroehlich yvonnefroehlich added the documentation Improvements or additions to documentation label May 29, 2023
@yvonnefroehlich yvonnefroehlich added this to the 0.11.0 milestone May 29, 2023
@yvonnefroehlich yvonnefroehlich self-assigned this May 29, 2023
@yvonnefroehlich yvonnefroehlich marked this pull request as draft May 29, 2023 19:07
@yvonnefroehlich yvonnefroehlich changed the title Add tutorial showing how to plot focal mechanisms (beachballs) WIP: Add tutorial showing how to plot focal mechanisms (beachballs) May 29, 2023
@yvonnefroehlich
Copy link
Member Author

/format

@yvonnefroehlich yvonnefroehlich changed the title WIP: Add tutorial showing how to plot focal mechanisms (beachballs) Add tutorial showing how to plot focal mechanisms (beachballs) Mar 18, 2025
@yvonnefroehlich yvonnefroehlich marked this pull request as ready for review March 18, 2025 07:34
@yvonnefroehlich
Copy link
Member Author

yvonnefroehlich commented Mar 18, 2025

@yvonnefroehlich The tutorial already looks good to me. Are there more changes you'd like to make?

From the content side I do not have things in mind I want to change at the moment (actually, the tutorial is already a bit longer). If we have additional GMT flags wrapped (e.g., #3526) we may want consider to extend this tutorial.

As this a longer tutorial, maybe we can have a second reviewer here 🙂?

@seisman seisman added the needs review This PR has higher priority and needs review. label Mar 18, 2025
@seisman seisman added final review call This PR requires final review and approval from a second reviewer and removed needs review This PR has higher priority and needs review. labels Mar 23, 2025
@seisman seisman mentioned this pull request Mar 23, 2025
29 tasks
Co-authored-by: Dongdong Tian <[email protected]>
@seisman seisman changed the title Add tutorial showing how to plot focal mechanisms (beachballs) Add a tutorial for plotting focal mechanisms (beachballs) Mar 24, 2025
@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Mar 24, 2025
@seisman seisman merged commit e452dfb into main Mar 24, 2025
10 checks passed
@seisman seisman deleted the add-tutorial-meca branch March 24, 2025 10:41
seisman added a commit that referenced this pull request Mar 24, 2025
@yvonnefroehlich yvonnefroehlich changed the title Add a tutorial for plotting focal mechanisms (beachballs) Add an advanced tutorial for plotting focal mechanisms (beachballs) Mar 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants